#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int t, n, m;
int p[105][105];
int dp[105][10005];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> t >> n >> m;
  rep(i, 1, t) rep(j, 1, n) cin >> p[i][j];
  rep(i, 1, t - 1) {
    rep(j, 1, n) {
      int w = p[i][j], v = p[i + 1][j] - p[i][j];
      if (v <= 0) continue;
      rep(k, w, m) dp[i][k] = max(dp[i][k], dp[i][k - w] + v);
    }
    m += dp[i][m];
  }
  cout << m;
  return 0;
}